package top.dbpanda.cmsjpa.common;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;

@Data
@AllArgsConstructor
@NoArgsConstructor
public class  CmsResponse<T> implements Serializable {
    private String msg;
    private Integer code;
    private T data;

    public CmsResponse(String success, int i) {
        this.msg = success;
        this.code = i;
    }

    public CmsResponse success() {
        return new CmsResponse("success", 200);
    }

    public static <T> CmsResponse<T> success(T data) {
        return new CmsResponse("success", 200, data);
    }
}
